<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Constructs an OpenSSL context for use with Event classes</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.eventsslcontext.html">EventSslContext</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.eventutil.html">EventUtil</a></div>
 <div class="up"><a href="class.eventsslcontext.html">EventSslContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="eventsslcontext.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EventSslContext::__construct</h1>
  <p class="verinfo">(PECL event &gt;= 1.2.6-beta)</p><p class="refpurpose"><span class="refname">EventSslContext::__construct</span> &mdash; <span class="dc-title">Constructs an OpenSSL context for use with Event classes</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-eventsslcontext.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><strong>EventSslContext::__construct</strong></span>
    ( <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$method</code>
   </span>
   , <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$options</code>
   </span>
   )</div>

  <p class="para rdfs-comment">
   Creates SSL context holding pointer to
   <em>SSL_CTX</em>
   (see the system manual).
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-eventsslcontext.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>

     <em><code class="parameter">method</code></em>
    </dt>

    <dd>

     <p class="para">
      One of
      <a href="class.eventsslcontext.html#eventsslcontext.constants" class="link">
       <em>EventSslContext::*_METHOD</em> constants</a>
      .
     </p>
    </dd>

   
   
    <dt>

     <em><code class="parameter">options</code></em>
    </dt>

    <dd>

     <p class="para">
      Associative array of SSL context options One of
      <a href="class.eventsslcontext.html#eventsslcontext.constants" class="link">
       <em>EventSslContext::OPT_*</em> constants</a>
      .
     </p>
    </dd>

   
  </dl>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-eventsslcontext.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns
   <a href="class.eventsslcontext.html" class="classname">EventSslContext</a>
   object.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-eventsslcontext.construct-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4181">
   <p><strong>Example #1 
    <span class="function"><strong>EventSslContext::__construct()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ctx&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">(</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">SSLv3_SERVER_METHOD</span><span style="color: #007700">,&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">OPT_LOCAL_CERT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$local_cert</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">OPT_LOCAL_PK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$local_pk</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">OPT_PASSPHRASE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"echo&nbsp;server"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">OPT_VERIFY_PEER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">EventSslContext</span><span style="color: #007700">::</span><span style="color: #0000BB">OPT_ALLOW_SELF_SIGNED&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">,<br />));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.eventsslcontext.html">EventSslContext</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.eventutil.html">EventUtil</a></div>
 <div class="up"><a href="class.eventsslcontext.html">EventSslContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
